1. Field of the Invention
The present invention generally relates to encoder circuits used in A/D converters or the like, and particularly relates to an encoder circuit that converts thermometer codes into binary codes.
2. Description of the Related Art
With the development of digital signal processing technologies, A/D converters are required to have increasingly high resolution and increasingly high precision. In order to satisfy such demands, it is vital to suppress the generation of error in the process time of A/D conversion.
In A/D converters, generally, an analog potential is input into a plurality of comparator circuits, which compare the input potential with respective reference potentials. The reference potentials are provided at equal intervals from the low potential to the high potential. The outputs of the comparator circuits are “0 . . . 000111 . . . 1” where the outputs of the lower-order comparators are “1” and the outputs above a certain comparator situated halfway from lower order to higher order are “0”. Such codes are referred to as thermometer codes.
For example, an exclusive-OR operation is performed between adjacent bits in a thermometer code, thereby extracting “1” only at the boundary between “0” and “1”. This detection signal may be converted into a binary code by a switch matrix and/or amplifier at a subsequent stage.
In A/D converters, however, the boundary between “0” and “1” that is supposed to appear only at one position may appear at two or more positions due to deviation in the inherent offset of each comparator, differences in clock signal delays when the comparators are operated at high frequency, signal fluctuation caused by noise, etc. In such a case, a straightforward encoder circuit that detects the boundary between “0” and “1” for the encoding purpose cannot cope with the situation, resulting in the generation of the code that is far cry from an originally intended correct binary code.
The encoder circuit designed to avoid an increase in the A/D conversion error even in the presence of thermometer code error has been developed (Patent Document 1). This encoder circuit performs an exclusive-OR operation between adjacent bits in the thermometer code, so that the inputting of an error code such as “0 . . . 001011 . . . 1” results in three consecutive bits becoming “1” as indications of “0/1” boundaries in the outputs of the exclusive-OR operation. A switch matrix then performs weighting such that “1” at the center of the plurality of “1” bits becomes effective as a boundary. At the end, an amplifier amplifies the weighted signal to determine “0”/“1”. This successfully corrects errors so as to obtain a code that is close to the originally intended correct binary code.
Further, Patent Document 2 discloses a binary search conversion method for encoding thermometer codes. This method divides a thermometer code by half at the centrally located bit, and conducts searches to find the position of the boundary in the halved codes according to “0”/“1” of the centrally located bit. Patent Document 3 and Patent Document 4 disclose a conversion method that conforms to a thermometer/binary conversion formula represented in Boolean algebra.
FIG. 1 shows output values obtained when 3-bit thermometer codes are input into the related-art encoder circuit as described above. Here, a total of eight patterns are shown with respect to the three bits of the thermometer code, including all the combinations of “0” and “1” that may occur at the time of error.
When a thermometer code having errors is input, two or more boundaries between “0” and “1” are in existence. The encoded output thus varies depending on which boundary is treated as a correct boundary. In the case of Case 6 shown in FIG. 1, for example, it is impossible to determine whether the abnormal thermometer code [0, 1, 0] should have correctly been [0, 1, 1], or [0, 0, 1], or [0, 0, 0]. When two or more “0”/“1” boundaries exist in this manner, two or more possibilities exist as a correct encoded value. This is shown as “POSSIBLE VALUES OF ENCODER OUTPUT” in FIG. 1. When there are two or more “POSSIBLE VALUES OF ENCODER OUTPUT”, a difference between the largest value and the smallest value is indicated as “DISTANCE”.
Cases 1, 5, 7, and 8 correspond to the situation where a proper thermometer code is entered. In such cases, any one of the related-art examples produces a correct encoded output.
Cases 3 and 6 correspond to the situation where an input thermometer code is abnormal, resulting in three possibilities as the encoded output. At this time, “DISTANCE” is 2. In Case 3, for example, BIT2 and BIT3 of the thermometer code constitute an abnormal pattern. For this input to be a proper thermometer code, BIT2 and BIT3 of the thermometer code should be [1, 1], [0, 1], or [0, 0] instead of [1, 0]. In this case, the possible outputs of the encoder are 3, 2, and 1, respectively.
Accordingly, when the thermometer code of Case 3 is input, and it is desired to minimize the average distance between the output of the encoder and all the possible outputs, the output of the encoder is preferably set to 2 that is the center value of the possible outputs 3, 2, and 1 of the encoder. In the case of Case 6, by the same token, the output of the encoder is preferably set to 1. The optimum encoder output that is obtained in such a manner is shown in FIG. 1 as “ENCODER OUTPUT DESIRED FOR PURPOSE OF MINIMIZING CONVERSION ERROR”.
Cases 2 and 4 correspond to the situation in which there are four possible patterns for the encoder output, i.e., the “DISTANCE” is 3. In Case 2, for example, BIT1, BIT2, and BIT3 of the thermometer code constitute an abnormal pattern. For this input to be a proper thermometer code, the thermometer code should be [1, 1, 1], [0, 1, 1], [0, 0, 1], or [0, 0, 0] instead of [1, 1, 0]. In this case, the possible outputs of the encoder are 3, 2, 1, and 0, respectively.
Accordingly, when the thermometer code of Case 2 is input, and it is desired to minimize the average distance between the output of the encoder and all the possible outputs, the output of the encoder is preferably set to 2 or 1 that is the center value of the possible outputs 3, 2, 1, and 0 of the encoder. In the case of Case 4, by the same token, the output of the encoder is preferably set to 2 or 1.
What is shown as “RELATED ART” IN FIG. 1 is the output of the encoder disclosed in Patent Document 1, and what is shown as “OTHER RELATED ART” is the output of the encoder disclosed in Patent Documents 2 through 4. As shown in FIG. 1, there are cases in which the output becomes unfixed “X” with respect to “RELATED ART”. With respect to “OTHER RELATED ART”, the encoder output often differs from “ENCODER OUTPUT DESIRED”.
In this manner, the related-art encoder circuits are not designed to take into account all the possible combinations of thermometer codes. Because of this, it is not possible to minimize the error of the encoder output when error occurs.
In consideration of what was described above, the present invention is aimed at providing an encoder circuit and A/D converter that can minimize the error of the encoder output with respect to all the possible combinations of thermometer codes.    Patent Document 1: Japanese Patent Application Publication No. 7-95089    Patent Document 2: Japanese Patent Application Publication No. 8-36466    Patent Document 3: Japanese Patent Application Publication No. 11-103253    Patent Document 4: Japanese Patent Application Publication No. 2000-134103